/* Popovers/Menus */

$popover_arrow_height: 12px;

//.the popover itself
.popup-menu-boxpointer {
  -arrow-border-radius: 3px;
  -arrow-background-color: transparent;
  -arrow-border-width: 0;
  -arrow-border-color: transparent;
  -arrow-base: 64px;
  -arrow-rise: 6px;
  -arrow-box-shadow: none; //dreaming. bug #689995
  margin: 0;
  background-image: none;
  border-radius: 0;
  box-shadow: none;
}

// container of the popover menu
.popup-menu {
  min-width: 15em;
  color: $fg_color;

  //.popup-status-menu-item { font-weight: normal;  color: pink; } //dunno what that is
  &.panel-menu {
    -boxpointer-gap: $container_margin; // distance from the panel
    margin-bottom: 1.75em;
  }
}

.popup-menu-content {
  padding: $container_padding 0;
  margin: 0 0 12px 12px;
  background-color: $menu_bg_color;
  border-radius: $buttons_radius;
  box-shadow: 0 3px 8px rgba(black, 0.2);
}

// menu items
.popup-menu-item {
  spacing: $container_padding;
  padding: $container_padding;
  margin: 0 $container_padding;
  color: $fg_color;
  transition-duration: $shorter_duration;
  border-radius: 100px;
  background-image: none;

  &:ltr { padding-right:1.75em; padding-left: 0; }
  &:rtl { padding-right: 0; padding-left:1.75em; }

  &:checked {
    background-color: if($variant == 'light', rgba(black, 0.15), #eaeaea);
    color: rgba(black, 0.75);
    font-weight: normal;
    border-radius: $buttons_radius $buttons_radius 0 0;
    border: none;
    box-shadow: none;

    &.selected {
      background-color: if($variant == 'light', rgba(black, 0.2), #e5e5e5);
      color: rgba(black, 0.85);
    }

    &:active {
      background-color: #dfdfdf;
      color: rgba(black, 0.75);
    }

    &.selected:active { background-color: if($variant == 'light', rgba(black, 0.15), #e0e0e0); color: rgba(black, 0.75); }
    &:insensitive { color: rgba(black, 0.35); }
  }

  &.selected {
    background-color: $divider_color;
    color: $fg_color;
    transition-duration: 0ms;
  }

  &:active {
    background-color: $track_color;
    color: $fg_color;
    transition-duration: $longer_duration;
  }

  &.selected:active { color: $fg_color; }
  &:insensitive { color: $disabled_fg_color; }
}

// all icons and other graphical elements
.popup-inactive-menu-item {
  color: $fg_color;

  &.selected:active { background-color: if($variant == 'light', rgba(black, 0.15), #e0e0e0); color: rgba(black, 0.75); }
  &:insensitive { color: $hint_fg_color; }
}

// symbolic icons in popover
.popup-menu-arrow,
.popup-menu-icon { icon-size: 16px; }

// popover submenus
.popup-sub-menu {
  margin: 0 $container_padding;
  color: rgba(black, 0.75);
  background-color: if($variant == 'light', rgba(black, 0.10), rgba(white, 0.95));
  border-radius: 0 0 $buttons_radius $buttons_radius;
  border: none;
  box-shadow: none;
  background-image: none;

  .popup-menu-item {
    margin: 0;
    border-radius: $buttons_radius;
    color: rgba(black, 0.75);
    background-image: none;

    &:hover {
      color: rgba(black, 0.85);
      background-color: rgba(black, 0.15);
    }

    &:active {
      color: rgba(black, 0.85);
      background-color: rgba(black, 0.2);
    }

    &.selected:active { color: rgba(black, 0.75); }

    &:not(:first-child):last-child {
      border-radius: 0 0 $buttons_radius $buttons_radius;
    }
  }
}

// container for radio and check boxes
.popup-menu-ornament {
  width: 1.2em;

  &:ltr { text-align: right };
  &:rtl { text-align: left };
}

// separator
.popup-separator-menu-item {
  background: none;
  border: none;
  padding: 0 0;
  margin: 0 0;
  height: 4px;

  .popup-separator-menu-item-separator {
    //-margin-horizontal: 24px;
    height: 1px; //not really the whole box
    margin: 0 0;
    padding: 0 0;
    background: none;

    .popup-sub-menu & { //submenu separators
      margin: 0 0;
      padding: 0 0;
      background: none;
    }
  }
}

// desktop background menu
.background-menu {
  -boxpointer-gap: $container_margin;
  -arrow-rise: 0px; // hide the beak on the menu
}

// system status menu
.aggregate-menu {
  min-width: if($laptop == 'true', 19em, 21em);

  .popup-menu-icon {
    padding: 0;
    margin: 0 $container_margin;
    -st-icon-style: symbolic;
  }

  .popup-sub-menu .popup-menu-item > :first-child {
    &:ltr { /* 12px spacing + 2*4px padding */
      padding-left: $container_padding * 2 + $container_margin; margin-left: 1.09em;
    }
    &:rtl { /* 12px spacing + 2*4px padding */
      padding-right: $container_padding * 2 + $container_margin; margin-right: 1.09em;
    }
  }
}
